audioClip
Type
object
Summary
An object type that contains sound data.
Syntax
audioClip
Description
Use the audioClip object type to play a sound that can either be stored in the stack, or in an external file.
Unlike a player, an audio clip contains the sound that it plays. In the case of imported audio clips, this increases the memory required by your stack, because the sound data is loaded into memory along with the rest of the stack whenever the stack file is open. However, it prevents the sound from being accidentally separated from the stack file and lost.
If your stack accesses external audio clips you must take care to keep the external file together with the stack file.
Audio clips can be in uncompressed WAV, AIFF, or AU format, which is always compressed. An audio clip may also be in 2:1 µ-law compressed AU format.
An audioClip object is contained in a stack. Audio clips cannot contain other objects. (Hence, an audioClip is not a control, since it has no user interface and cannot be owned by a card.)
To play an audioClip, use the syntax
play audioClip <filename_of_audioclip>
Or the syntax
play audioClip \"/path/to/file.wav\"
To stop an audioClip, use the syntax
play stop
Examples
# play an internal (imported) audio clip
local theCurrentSoundtrack
put the short name of audioClip 1 into theCurrentSoundtrack
play audioClip theCurrentSoundtrack
# play an external audio clip
play audioClip "/Documents/audio/sample.wav"
delete audioClip 1
Related
keyword: templateAudioClip
object: card, stack, videoClip
command: play
glossary: object type, audio clip, control, stack file
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
Platforms
desktop
server